package com.clps.cn.Activite03;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;

/**
 * 业务主键的添加,进businesskey
 */
public class BusinessKeyAdd {

    public static void main(String[] args) {

        //得到ProcessEngined对象
        ProcessEngine defaultProcessEngine = ProcessEngines.getDefaultProcessEngine();

        //02:得到runtimeService对象
        RuntimeService runtimeService = defaultProcessEngine.getRuntimeService();
        //启动流程，同时还要指定业务标识，businessKey,本身就是请假单的id
        //第一个个参数是：流程中定义的key
        //第二个参数是businesskey
        ProcessInstance holiday = runtimeService.startProcessInstanceByKey("holiday", "1001");

        //04输出processInstance相关的属性
        System.out.println("holiday.getBusinessKey() = " + holiday.getBusinessKey());


    }
}
